package org.geektimes.configuration;

import org.eclipse.microprofile.config.Config;
import org.geektimes.configuration.facade.DefaultConfigBuilder;

/**
 * @author lanxing
 */
public class MicroProfileConfigDemo {

    public static void main(String[] args) {
        System.out.println(System.getenv());
        Config config = new DefaultConfigBuilder(Thread.currentThread().getContextClassLoader())
                .addDefaultSources().addDiscoveredSources().addDiscoveredConverters().build();
        //获取JVM配置
        String runtimeName = config.getValue("java.runtime.name",String.class);
        System.out.println("java.runtime.name="+runtimeName);
        //获取操作系统环境变量
        String processors = config.getValue("PATH",String.class);
        System.out.println("PATH="+processors);
        //获取本地配置文件
        String configTest = config.getValue("test.config",String.class);
        System.out.println("test.config="+configTest);
    }

}
